 //
//  MPTLiveHomeCenterVC.m
//  MPTLive
//
//  Created by HouGeng on 16/2/24.
//  Copyright © 2016年 Jeakin. All rights reserved.
//

#import "MPTLiveHomeCenterVC.h"
#import "GMCategaryScrollBar.h"
#import "MPTLiveHomeVC.h"
#import "MPTLiveZuiXinVC.h"

@interface MPTLiveHomeCenterVC ()
{
    GMCategaryScrollBar *scrb;
}


@end


@implementation MPTLiveHomeCenterVC


#pragma mark - ********************** View Lifecycle **********************

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    [self initNaV];
    
    NSMutableArray *ary = [NSMutableArray arrayWithArray:@[@"热门",@"关注",@"最新"]];
    
    scrb = [GMCategaryScrollBar categaryScrollBar];
    [scrb categaryBarTitle:ary withIsEqualBtn:NO];
    [self.view addSubview:scrb];
    
    NSArray *aryType = @[@"hot",@"feed",@"new"];
    // 组装VC
    NSMutableArray *maryVC = [NSMutableArray array];
    for (NSInteger i = 0; i < ary.count; i++)
    {
        if (i == 2)
        {
            MPTLiveZuiXinVC *vc = [[MPTLiveZuiXinVC alloc] init];
            vc.strType = aryType[i];
            [maryVC addObject:vc];
            [self addChildViewController:vc];
        }
        else
        {
            MPTLiveHomeVC *vc = [[MPTLiveHomeVC alloc] init];
            vc.strType = aryType[i];
            [maryVC addObject:vc];
            [self addChildViewController:vc];
        }
    }
    // 给唐丽封装控件的属性赋值
    scrb.maryVC = maryVC;
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gundong) name:@"gundongdaoHot" object:nil];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

- (void)dealloc
{
    // 一定要关注这个函数是否被执行了！！！
}

- (void)initNaV
{
    
}

-(void)gundong
{
    [scrb automaticScroll:0];
}

@end
